package com.wlyuan.index.infrastructure.converter;

import com.wlyuan.core.marker.NamedUtils;
import com.wlyuan.core.marker.ValueUtils;
import com.wlyuan.index.domain.index.OrderIndex;
import com.wlyuan.index.domain.index.repository.old.OrderIndexOld;
import com.wlyuan.index.domain.source.utils.SourceUtils;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.time.LocalDateTime;

public class OrderIndexConverter {
    @Mapper(uses = {ValueUtils.class, NamedUtils.class, SourceUtils.class},
            imports = {LocalDateTime.class})
    public interface Converter {
        OrderIndex convert(OrderIndexOld source);
    }

    private static final Converter CONVERTER = Mappers.getMapper(Converter.class);

    public static OrderIndex convert(OrderIndexOld source) {
        return CONVERTER.convert(source);
    }
}
